// DocumentWebPage.cpp: implementation of the CDocumentWebPage class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "AUSlotsTester.h"
#include "DocumentWebPage.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CDocumentWebPage::CDocumentWebPage( const CAUSlotsTesterDoc* pDoc )
{
	m_pDoc = pDoc;
}

CDocumentWebPage::~CDocumentWebPage()
{
}

void CDocumentWebPage::GenerateContent()
{
	BeginDocument();

		BeginHead();

			BeginTitle();

				InsertContent( m_pDoc->GetTitle() );

				if ( GetSubTitle() )
				{
					InsertContent( _T( "&nbsp;:&nbsp;" ) );
					InsertContent( GetSubTitle() );
				}

			EndTitle();

		EndHead();

		BeginBody();

			BeginHeading( 3, haCenter );

				InsertContent( m_pDoc->GetTitle() );

				if ( GetSubTitle() )
				{
					InsertContent( _T( "&nbsp;:&nbsp;" ) );
					InsertContent( GetSubTitle() );
				}

			EndHeading( 3 );

			BeginTable( 100, true );

				BeginRow();

					BeginColumn( 3, crBlack );

					EndColumn();

				EndRow();

			EndTable();

			BeginTable( haCenter );

				BeginRow();

					BeginColumn();

						bool bEndAnchor = false;

						if ( GetFilePath() != m_pDoc->GetHomeURL() )
						{
							BeginAnchor( m_pDoc->GetHomeURL() );
							bEndAnchor = true;
						}

						InsertContent( _T( "Home" ) );

						if ( bEndAnchor )
						{
							EndAnchor();
						}

					EndColumn();

					BeginColumn( 10 );

					EndColumn();

					BeginColumn();
						
						bEndAnchor = false;

						if ( GetFilePath() != m_pDoc->GetStatisticalAnalysisURL() )
						{
							BeginAnchor( m_pDoc->GetStatisticalAnalysisURL() );
							bEndAnchor = true;
						}
						
						InsertContent( _T( "Statistical Analysis" ) );

						if ( bEndAnchor )
						{
							EndAnchor();
						}

					EndColumn();

					BeginColumn( 10 );

					EndColumn();

					BeginColumn();
						
						bEndAnchor = false;

						if ( GetFilePath() != m_pDoc->GetPayoutHistoryURL() )
						{
							BeginAnchor( m_pDoc->GetPayoutHistoryURL() );
							bEndAnchor = true;
						}

						InsertContent( _T( "Payout History" ) );

						if ( bEndAnchor )
						{
							EndAnchor();
						}

					EndColumn();

					BeginColumn( 10 );

					EndColumn();

					BeginColumn();
						
						bEndAnchor = false;

						if ( GetFilePath() != m_pDoc->GetFullReportURL() )
						{
							BeginAnchor( m_pDoc->GetFullReportURL() );
							bEndAnchor = true;
						}
						
						InsertContent( _T( "Full Report" ) );

						if ( bEndAnchor )
						{
							EndAnchor();
						}

					EndColumn();

/*					Maybe some day I will have time to do this cool graph.
					BeginColumn( 10 );

					EndColumn();

					BeginColumn();
						
						bEndAnchor = false;

						if ( GetFilePath() != m_pDoc->GetPayoutGraphURL() )
						{
							BeginAnchor( m_pDoc->GetPayoutGraphURL() );
							bEndAnchor = true;
						}
						
						InsertContent( _T( "Payout Graph" ) );

						if ( bEndAnchor )
						{
							EndAnchor();
						}

					EndColumn();*/

				EndRow();

			EndTable();

			InsertContent( _T( "&nbsp;" ) );

			GenerateBodyContent();

		EndBody();

	EndDocument();
}

LPCTSTR CDocumentWebPage::GetSubTitle() const
{
	return NULL;
}

const CAUSlotsTesterDoc& CDocumentWebPage::GetDocument() const
{
	return *m_pDoc;
}

const CSpinTestResults& CDocumentWebPage::GetResults() const
{
	return m_pDoc->GetResults();
}
